using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace Mark.Data;

/// <summary>
/// 设计时 DbContext 工厂，用于 EF Core 迁移
/// </summary>
public class MarkDbContextFactory : IDesignTimeDbContextFactory<MarkDbContext>
{
    public MarkDbContext CreateDbContext(string[] args)
    {
        var optionsBuilder = new DbContextOptionsBuilder<MarkDbContext>();
        
        // 使用SQLite数据库连接字符串
        var dbPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Mark", "mark.db");
        optionsBuilder.UseSqlite($"Data Source={dbPath}");

        return new MarkDbContext(optionsBuilder.Options);
    }
} 